package com.iot.openfeign;

import com.dc3.common.bean.R;
import org.springframework.web.bind.annotation.*;
import reactivefeign.spring.config.ReactiveFeignClient;
import reactor.core.publisher.Mono;

import java.util.Set;

/**
 * @Author 咕唧
 * @Date 2022/7/19 17:28
 * @Version 1.0
 */
@ReactiveFeignClient(value = "iot-cache")
public interface CacheClient {
    @PostMapping("/cache/set")
    Mono<R> setValue(@RequestParam String key, @RequestParam String value);

    @GetMapping("/cache/value")
    Mono<R> getValue(@RequestParam String key);


    @PostMapping("/cache/set/seconds")
    Mono<R> setValueWithExp(@RequestParam("key") String key, @RequestParam("value") String value, @RequestParam("expireTime") Long expireTime);


    @PostMapping("/cache/sadd/{key}")
    Mono<R> sAdd(@PathVariable String key, @RequestBody Set<String> values) ;

    @GetMapping("/cache/smember/{key}")
    Mono<R> sMember(@PathVariable String key);

    @PostMapping("/cache/keys/delete")
    Mono<R> deleteKeys(@RequestBody Set<String> values);
}
